[Chapter 10] Rule Set 3
Author: Bryan Costales & Eric Allman
Date: 1999-01-06T18:36:09Z

#

| Chapter 10 |

# 10. Rule Set 3

Contents:
Why Preprocess?
Rule Set 3
Missing Addresses
Nested Angle Brackets
Details of Rule Flow
Things to Try

The job of rule sets 1 through 4 is to change recipient and sender addresses in both the header and the envelope [1] into a form appropriate for a given delivery agent. Each kind of address takes a different path through the rule sets. The possibilities (which can be confusing) are illustrated in Figure 10.1.

> [1] Headers and envelopes were introduced in Chapter 1, Introduction.

#### Figure 10.1: The flow of addresses through rule sets

The sender's address on the envelope, for example, is first rewritten by rule set 3, then by rule set 1, then by the rule set specified by the `S=` equate in the delivery agent definition, and finally by rule set 4.

All addresses are first processed by rule set 3. All sender addresses flow through rule set 3 and then 1. All recipient addresses flow through 3 and then 2. Each then flows through the rule set that is specified by the `S=` or `R=` equate for the delivery agent that will handle the message. Each is then postprocessed by rule set 4. But because the role of rule set 0 is to select a delivery agent (and therefore the appropriate `S=` and `R=` equates), rule set 0 needs to process an address before it can go through rule set 1 or 2.

In the previous few chapters you began to learn about rules sets in general and rule set 0 specifically. However, before the recipient address can be processed by rule set 0, it must first be processed by rule set 3. All addresses are preprocessed by rule set 3.

## 10.1 Why Preprocess?

To understand why a preprocessing rule set (rule set 3) is needed, we need to briefly examine how users specify addresses. One common way to send mail is by using the reply feature of your mail-reading program (MUA). That feature looks at the `From:` line in the mail message's header and uses the text that follows as the address for the reply. That text can take one of two forms:

>     From: address (Full Name and other comments)
>     From: Full Name <address>

Both forms are legal. The first is an email address followed by arbitrary text in parentheses, usually the user's full name. The parentheses form a comment. Your mail reading program often strips that comment before sending the mail, so sendmail sees only `address`. But even if the comment isn't stripped, sendmail removes (and saves) the text in parentheses before entering rule set 3.

The second form has the user's full name first, followed by the email address in angle brackets. When your MUA sends email using this form of return address, it hands sendmail the entire text: full name, and address in angle brackets.

In both cases, what sendmail needs is the `address` part. But, as in the second case, sendmail can get more than just the `address`. Therefore sendmail needs a way to discard everything else:

>     Full Name <address>

>     needs to be transformed into

>     address

The sendmail program handles this initial transformation by preprocessing addresses using rule set 3.

9.5 Things to Try |  | 10.2 Rule Set 3